{% extends 'base.html' %}


{% block tips %}
    <h3>添加作者</h3>
{% endblock tips %}


{% block content %}

    <div class=" col-md-offset-1 col-md-10">
        <a href="{% url 'book:author_show' %}">
            <button type="button" class="btn btn-primary">作者列表</button>
        </a>
        <form action="{% url 'book:author_add' %}" method="post">
            {% csrf_token %}
            <div class="form-group">
                <label for="name">作者姓名</label>
                <input type="text" class="form-control" id="name" name="name" placeholder="名字">
            </div>
            <div class="form-group">
                <label for="age">年龄</label>
                <input type="number" class="form-control" id="age" name="age" placeholder="年龄">
            </div>
            <div class="form-group">
                <p><label for="authordetail">作者详情</label></p>
                <select name="authordetail">
                    {% for detail in authordetails %}
                        <option value="{{ detail.id }}" {% ifequal select_id detail.id %}
                                selected=selected {% endifequal %}>{{ detail }}</option>
                    {% endfor %}
                </select>
                <a href="{% url 'book:author_detail_add' %}">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                </a>
            </div>
            <button type="submit" class="btn btn-success pull-right">添加</button>
        </form>
    </div>

{% endblock content %}
